package com.xindaoapp.framework.base;

import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.lidroid.xutils.ViewUtils;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.xindaoapp.framework.R;

public class BaseActivity extends FragmentActivity {
	public BaseActivity() {
		super();
	}
	@Override
	protected void onStart() {
		super.onStart();
		View back = findViewById(R.id.tittle_common_cancel);
		if (null != back) {
			back.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					finish();
				}
			});
		}

		setTabTitle(getTabTitle());
	}

	/**
	 * 获取标题内容
	 * @return
	 */
	protected Object getTabTitle() {
		return null;
	}

	/**
	 * 设置标题
	 * @param obj
	 */
	protected void setTabTitle(Object obj) {
		TextView title = (TextView) findViewById(R.id.title);
		if (null != title) {
			if (obj instanceof Integer) {
				title.setText(Integer.parseInt(obj.toString()));
			} else if (obj instanceof String) {
				title.setText((String) obj);
			}
		}
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
//		ImageLoader.getInstance().clearMemoryCache();
	}

}
